home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998…eptember: Technology Seed / September 98 ADC Seed CD.toast / FireWire 1.1 DR2 SDK / Interfaces / Types.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-15  |  7.7 KB  |  367 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Types.h
  3.  
  4.      Contains:    Basic Macintosh data types.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2.
  7.                  Package:    Universal Interfaces 2.1.2 on ETO #20
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __TYPES__
  21. #define __TYPES__
  22.  
  23.  
  24. #ifndef __CONDITIONALMACROS__
  25. #include <ConditionalMacros.h>
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #if PRAGMA_ALIGN_SUPPORTED
  33. #pragma options align=mac68k
  34. #endif
  35.  
  36. #if PRAGMA_IMPORT_SUPPORTED
  37. #pragma import on
  38. #endif
  39.  
  40. #ifndef NULL
  41. #if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C))
  42. #define NULL ((void *) 0)
  43. #else
  44. #define NULL 0
  45. #endif
  46. #endif
  47. #ifndef nil
  48. #define nil NULL
  49. #endif
  50.  
  51. enum {
  52.     noErr                        = 0
  53. };
  54.  
  55. typedef unsigned char Byte;
  56.  
  57. typedef signed char SignedByte;
  58.  
  59. typedef Byte UInt8;
  60.  
  61. typedef SignedByte SInt8;
  62.  
  63. typedef unsigned short UInt16;
  64.  
  65. typedef signed short SInt16;
  66.  
  67. typedef unsigned long UInt32;
  68.  
  69. typedef signed long SInt32;
  70.  
  71. typedef UInt16 UniChar;
  72.  
  73. typedef char *Ptr;
  74.  
  75. typedef Ptr *Handle;
  76.  
  77. typedef long Fixed;
  78.  
  79. typedef Fixed *FixedPtr;
  80.  
  81. typedef long Fract;
  82.  
  83. typedef Fract *FractPtr;
  84.  
  85. struct _extended80 {
  86.     short                            exp;
  87.     short                            man[4];
  88. };
  89. struct _extended96 {
  90.     short                            exp[2];
  91.     short                            man[4];
  92. };
  93. #if GENERATING68K 
  94. #if defined(__MWERKS__)
  95. /* Note: Metrowerks on 68K doesn't declare 'extended' or 'comp' implicitly. */
  96. typedef long double extended;
  97. typedef struct comp { long hi,lo; } comp;
  98.  
  99. #elif defined(THINK_C)
  100. /* Note: THINK C doesn't declare 'comp' implicitly and needs magic for 'extended' */
  101. typedef struct { short man[4]; } comp;
  102. typedef struct _extended80 __extended;    /*  <-- this line is magic */
  103. typedef __extended extended;
  104.  
  105. #endif
  106. /* 
  107. Note: on PowerPC extended is undefined.
  108.       on 68K when mc68881 is on, extended is 96 bits.  
  109.              when mc68881 is off, extended is 80 bits.  
  110.       Some old toolbox routines require an 80 bit extended so we define extended80
  111. */
  112. #if GENERATING68881
  113. typedef struct _extended80 extended80;
  114.  
  115. typedef extended extended96;
  116.  
  117. #else
  118. typedef extended extended80;
  119.  
  120. typedef struct _extended96 extended96;
  121.  
  122. #endif
  123. #else
  124. typedef struct _extended80 extended80;
  125.  
  126. typedef struct _extended96 extended96;
  127.  
  128. #endif
  129. /*
  130. Note: float_t and double_t are "natural" computational types
  131.       (i.e.the compiler/processor can most easily do floating point
  132.       operations with that type.) 
  133. */
  134. #if GENERATINGPOWERPC
  135. /* on PowerPC, double = 64-bit which is fastest.  float = 32-bit */
  136. typedef float float_t;
  137.  
  138. typedef double double_t;
  139.  
  140. #else
  141. /* on 68K, long double (a.k.a. extended) is always the fastest.  It is 80 or 96-bits */
  142. typedef long double float_t;
  143.  
  144. typedef long double double_t;
  145.  
  146. #endif
  147. struct wide {
  148.     SInt32                            hi;
  149.     UInt32                            lo;
  150. };
  151. typedef struct wide wide, *WidePtr;
  152.  
  153. struct UnsignedWide {
  154.     UInt32                            hi;
  155.     UInt32                            lo;
  156. };
  157. typedef struct UnsignedWide UnsignedWide, *UnsignedWidePtr;
  158.  
  159. #if defined(__SC__) && !defined(__STDC__) && defined(__cplusplus)
  160.     class __machdl HandleObject {};
  161. #if !GENERATINGPOWERPC
  162.     class __pasobj PascalObject {};
  163. #endif
  164. #endif
  165.  
  166. enum {
  167.     false,
  168.     true
  169. };
  170.  
  171. typedef unsigned char Boolean;
  172.  
  173.  
  174. enum {
  175.     v,
  176.     h
  177. };
  178.  
  179. typedef SInt8 VHSelect;
  180.  
  181. typedef long (*ProcPtr)();
  182. typedef pascal void (*Register68kProcPtr)(void);
  183. typedef ProcPtr *ProcHandle;
  184.  
  185. #if    GENERATINGCFM
  186. typedef struct RoutineDescriptor *UniversalProcPtr, **UniversalProcHandle;
  187.  
  188. #else
  189. typedef ProcPtr UniversalProcPtr, *UniversalProcHandle;
  190.  
  191. #endif
  192. typedef unsigned char Str255[256], Str63[64], Str32[33], Str31[32], Str27[28], Str15[16];
  193.  
  194. typedef unsigned char *StringPtr, **StringHandle;
  195.  
  196. typedef const unsigned char *ConstStr255Param;
  197.  
  198. typedef ConstStr255Param ConstStr63Param, ConstStr32Param, ConstStr31Param, ConstStr27Param, ConstStr15Param;
  199.  
  200. #ifdef __cplusplus
  201. inline unsigned char StrLength(ConstStr255Param string) { return (*string); }
  202. #else
  203. #define StrLength(string) (*(unsigned char *)(string))
  204. #endif
  205. #if OLDROUTINENAMES
  206. #define Length(string) StrLength(string)
  207. #endif
  208. typedef short OSErr;
  209.  
  210. typedef short ScriptCode;
  211.  
  212. typedef short LangCode;
  213.  
  214. typedef unsigned long FourCharCode;
  215.  
  216.  
  217. enum {
  218.     normal                        = 0,
  219.     bold                        = 1,
  220.     italic                        = 2,
  221.     underline                    = 4,
  222.     outline                        = 8,
  223.     shadow                        = 0x10,
  224.     condense                    = 0x20,
  225.     extend                        = 0x40
  226. };
  227.  
  228. typedef unsigned char Style;
  229.  
  230. typedef FourCharCode OSType;
  231.  
  232. typedef FourCharCode ResType;
  233.  
  234. typedef OSType *OSTypePtr;
  235.  
  236. typedef ResType *ResTypePtr;
  237.  
  238. struct Point {
  239.     short                            v;
  240.     short                            h;
  241. };
  242. typedef struct Point Point;
  243.  
  244. typedef Point *PointPtr;
  245.  
  246. struct Rect {
  247.     short                            top;
  248.     short                            left;
  249.     short                            bottom;
  250.     short                            right;
  251. };
  252. typedef struct Rect Rect;
  253.  
  254. typedef Rect *RectPtr;
  255.  
  256. /*
  257.     kVariableLengthArray is used in array bounds to specify a variable length array.
  258.     It is ususally used in variable length structs when the last field is an array
  259.     of any size.  Before ANSI C, we used zero as the bounds of variable length 
  260.     array, but that is illegal in ANSI C.  Example:
  261.     
  262.         struct FooList 
  263.         {
  264.             short     listLength;
  265.             Foo        elements[kVariableLengthArray];
  266.         };
  267. */
  268.  
  269. enum {
  270.     kVariableLengthArray        = 1
  271. };
  272.  
  273. /* Numeric version part of 'vers' resource */
  274. struct NumVersion {
  275.     UInt8                            majorRev;                    /*1st part of version number in BCD*/
  276.     UInt8                            minorAndBugRev;                /*2nd & 3rd part of version number share a byte*/
  277.     UInt8                            stage;                        /*stage code: dev, alpha, beta, final*/
  278.     UInt8                            nonRelRev;                    /*revision level of non-released version*/
  279. };
  280. typedef struct NumVersion NumVersion;
  281.  
  282. /* 'vers' resource format */
  283. struct VersRec {
  284.     NumVersion                        numericVersion;                /*encoded version number*/
  285.     short                            countryCode;                /*country code from intl utilities*/
  286.     Str255                            shortVersion;                /*version number string - worst case*/
  287.     Str255                            reserved;                    /*longMessage string packed after shortVersion*/
  288. };
  289. typedef struct VersRec VersRec;
  290.  
  291. typedef VersRec *VersRecPtr, **VersRecHndl;
  292.  
  293. typedef struct OpaqueRef *KernelID;
  294.  
  295. typedef UInt8 *BytePtr;
  296.  
  297. typedef UInt32 ByteCount;
  298.  
  299. typedef UInt32 ItemCount;
  300.  
  301. typedef SInt32 OSStatus;
  302.  
  303. typedef void *LogicalAddress;
  304.  
  305. typedef void *PhysicalAddress;
  306.  
  307. typedef UInt32 OptionBits;
  308.  
  309. typedef UInt32 PBVersion;
  310.  
  311. typedef UnsignedWide AbsoluteTime;
  312.  
  313. typedef SInt32 Duration;
  314.  
  315. #define kInvalidID 0
  316.  
  317. enum {
  318.     kNilOptions                    = 0
  319. };
  320.  
  321. /*
  322.     Who implements what debugger functions:
  323.     
  324.     Name            MacsBug                SADE        Macintosh Debugger
  325.     ----------        -----------            -------        -----------------------------
  326.     Debugger        yes                    no            InterfaceLib maps to DebugStr
  327.     DebugStr        yes                    no            yes
  328.     Debugger68k        yes                    no            InterfaceLib maps to DebugStr
  329.     DebugStr68k        yes                    no            InterfaceLib maps to DebugStr
  330.     debugstr        yes                    no            InterfaceLib maps to DebugStr
  331.     SysBreak        no, for SADE        yes            InterfaceLib maps to SysError
  332.     SysBreakStr        no, for SADE        yes            InterfaceLib maps to SysError
  333.     SysBreakFunc    no, for SADE        yes            InterfaceLib maps to SysError
  334.  
  335. */
  336. extern pascal void Debugger(void)
  337.  ONEWORDINLINE(0xA9FF);
  338. extern pascal void DebugStr(ConstStr255Param debuggerMsg)
  339.  ONEWORDINLINE(0xABFF);
  340. extern pascal void Debugger68k(void)
  341.  ONEWORDINLINE(0xA9FF);
  342. extern pascal void DebugStr68k(ConstStr255Param debuggerMsg)
  343.  ONEWORDINLINE(0xABFF);
  344. #if CGLUESUPPORTED
  345. extern void debugstr(const char *debuggerMsg);
  346. #endif
  347. extern pascal void SysBreak(void)
  348.  THREEWORDINLINE(0x303C, 0xFE16, 0xA9C9);
  349. extern pascal void SysBreakStr(ConstStr255Param debuggerMsg)
  350.  THREEWORDINLINE(0x303C, 0xFE15, 0xA9C9);
  351. extern pascal void SysBreakFunc(ConstStr255Param debuggerMsg)
  352.  THREEWORDINLINE(0x303C, 0xFE14, 0xA9C9);
  353.  
  354. #if PRAGMA_IMPORT_SUPPORTED
  355. #pragma import off
  356. #endif
  357.  
  358. #if PRAGMA_ALIGN_SUPPORTED
  359. #pragma options align=reset
  360. #endif
  361.  
  362. #ifdef __cplusplus
  363. }
  364. #endif
  365.  
  366. #endif /* __TYPES__ */
  367.